package com.wll;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created on 2021/1/6 。
 *
 * @author wll 1978992154@qq.com
 */
public class DemoTest01 {

    @Test
    public void test1(){
        ApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserDao userDao =(UserDao) app.getBean("userDao");
        userDao.say();
    }

    @Test
    /**
     * 测试scope属性之 单列  此时地址都是一样的 如果没有修改配置文件的话
     */
    public void test2(){
        ApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");
        GoodsDao userDao1 =(GoodsDao) app.getBean("goodsDao");
        GoodsDao userDao2 =(GoodsDao) app.getBean("goodsDao");
        System.out.println(userDao1);
        System.out.println(userDao2);
    }
}
